package com.bifang.common.exception;


import com.bifang.common.interfaces.BaseError;

public class AppException extends RuntimeException {
    private String msg;
    private Integer code;
    private String extCode;
    private Object data;
    /** 自定义异常处理类 auth:chenzh date:2016-12-27 */
    public AppException(String msg) {
        super(msg);
        this.msg = msg;
    }

    public AppException(Integer code, String msg) {
        super(msg);
        this.msg = msg;
        this.code = code;
    }

    public AppException(Integer code, String msg, Object data) {
        super(msg);
        this.msg = msg;
        this.code = code;
        this.data = data;
    }

    public AppException(BaseError errorEnum) {
        super(errorEnum.getMessage());
        this.msg = errorEnum.getMessage();
        this.code = errorEnum.getCode();
        this.extCode = errorEnum.getExtCode();
    }

    public AppException(BaseError errorEnum, Object data) {
        super(errorEnum.getMessage());
        this.msg = errorEnum.getMessage();
        this.code = errorEnum.getCode();
        this.extCode = errorEnum.getExtCode();
        this.data = data;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public String getExtCode() {
        return extCode;
    }

    public void setExtCode(String extCode) {
        this.extCode = extCode;
    }
}
